<?php
defined('_JEXEC') or die('Restricted access');
$mealPeriod = JHTMLwrd::listMealPeriodRaw();
$complainType = JHTMLwrd::listComplainTypeRaw();
?>
<div class="row-fluid">
	<div class="alert">
		<table>
			 <tr>
			 	<td colspan="4" style="text-align: right ;">
			 		<?php if($this->user->authorise('wrd.profile.complaint.add', 'com_wrd')): ?>
			 		<a href="index.php?option=com_wrd&controller=complain&task=add<?php if(!empty($this->data->member_id)){ echo '&vip_num='.$this->data->member_id ; } ?>">				 		
			 		<img title="Add New" style="float: right ;" src="<?php echo JURI::base() .'/components/com_wrd/assets/images/add_new.png'?>"></a>
			 		<?php endif; ?>
			 	</td>
			 </tr>
	 	</table>
 	</div>
	<table  class="adminlist extra-adminlist table table-striped" >
        <thead>
		     <tr>
		 	    <th>Member ID</th>        
                <th>Name</th> 
                <th>Created Date</th>
                <th>Comment</th>
                <th>Action Taken</th>                        
                <th>Complain Type</th>
                <th>Meal period</th>        
                <th>Outlet</th>  
                <th>Visit Date</th> 
                <th>Handle By</th>    
		     </tr>
         </thead>
         
         <tbody>
		     <?php if(count($this->u_complains) > 0): ?>
			     <?php foreach ($this->u_complains as $u_complains): ?>
			 	    <tr>
			 	    	
			 		    <td style="text-align: center;"><?php echo $u_complains->vip_number ; ?></td>
                        <td>
                            <a target="_blank" href="index.php?option=com_wrd&controller=complain&id=<?php echo $u_complains->id; ?>&layout=form">
                                <?php echo $u_complains->guest_name; ?>
                            </a>
                        </td>
			 		    <td style="text-align: center;"><?php echo $u_complains->created_date ; ?></td>
                        
			 		    <td><?php echo $u_complains->complain; ?></td>
					    <td><?php echo $u_complains->action_taken ; ?></td>					    
	                    <td><?php echo $complainType[$u_complains->complain_type] ?></td>
                        
	                    <td><?php echo $mealPeriod[$u_complains->meal_period]; ?></td>
	                    <td><?php echo $u_complains->outlet_name ; ?></td>
	                    <td style="text-align: center;"><?php echo $u_complains->visit_date ; ?></td>
	                    <td><?php echo $u_complains->handle_name ; ?></td>		
			 	    </tr>
			     <?php endforeach; ?>
		     <?php endif; ?>
         </tbody>
	 </table>
</div>